home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_gtk / INCLUDE / GTK / GTKTREE.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  5KB  |  133 lines

  1. /* GTK - The GIMP Toolkit
  2.  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3.  *
  4.  * This library is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU Library General Public
  6.  * License as published by the Free Software Foundation; either
  7.  * version 2 of the License, or (at your option) any later version.
  8.  *
  9.  * This library is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.  * Library General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU Library General Public
  15.  * License along with this library; if not, write to the
  16.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17.  * Boston, MA 02111-1307, USA.
  18.  */
  19.  
  20. /*
  21.  * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
  22.  * file for a list of people on the GTK+ Team.  See the ChangeLog
  23.  * files for a list of changes.  These files are distributed with
  24.  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  25.  */
  26.  
  27. #ifndef __GTK_TREE_H__
  28. #define __GTK_TREE_H__
  29.  
  30. /* set this flag to enable tree debugging output */
  31. /* #define TREE_DEBUG */
  32.  
  33. #include <gdk/gdk.h>
  34. #include <gtk/gtkcontainer.h>
  35.  
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif /* __cplusplus */
  40.  
  41.  
  42. #define GTK_TYPE_TREE                  (gtk_tree_get_type ())
  43. #define GTK_TREE(obj)                  (GTK_CHECK_CAST ((obj), GTK_TYPE_TREE, GtkTree))
  44. #define GTK_TREE_CLASS(klass)          (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TREE, GtkTreeClass))
  45. #define GTK_IS_TREE(obj)               (GTK_CHECK_TYPE ((obj), GTK_TYPE_TREE))
  46. #define GTK_IS_TREE_CLASS(klass)       (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TREE))
  47.  
  48. #define GTK_IS_ROOT_TREE(obj)   ((GtkObject*) GTK_TREE(obj)->root_tree == (GtkObject*)obj)
  49. #define GTK_TREE_ROOT_TREE(obj) (GTK_TREE(obj)->root_tree ? GTK_TREE(obj)->root_tree : GTK_TREE(obj))
  50. #define GTK_TREE_SELECTION(obj) (GTK_TREE_ROOT_TREE(obj)->selection)
  51.  
  52. typedef enum 
  53. {
  54.   GTK_TREE_VIEW_LINE,  /* default view mode */
  55.   GTK_TREE_VIEW_ITEM
  56. } GtkTreeViewMode;
  57.  
  58. typedef struct _GtkTree       GtkTree;
  59. typedef struct _GtkTreeClass  GtkTreeClass;
  60.  
  61. struct _GtkTree
  62. {
  63.   GtkContainer container;
  64.   
  65.   GList *children;
  66.   
  67.   GtkTree* root_tree; /* owner of selection list */
  68.   GtkWidget* tree_owner;
  69.   GList *selection;
  70.   guint level;
  71.   guint indent_value;
  72.   guint current_indent;
  73.   guint selection_mode : 2;
  74.   guint view_mode : 1;
  75.   guint view_line : 1;
  76. };
  77.  
  78. struct _GtkTreeClass
  79. {
  80.   GtkContainerClass parent_class;
  81.   
  82.   void (* selection_changed) (GtkTree   *tree);
  83.   void (* select_child)      (GtkTree   *tree,
  84.                   GtkWidget *child);
  85.   void (* unselect_child)    (GtkTree   *tree,
  86.                   GtkWidget *child);
  87. };
  88.  
  89.  
  90. GtkType    gtk_tree_get_type           (void);
  91. GtkWidget* gtk_tree_new                (void);
  92. void       gtk_tree_append             (GtkTree          *tree,
  93.                         GtkWidget        *tree_item);
  94. void       gtk_tree_prepend            (GtkTree          *tree,
  95.                         GtkWidget        *tree_item);
  96. void       gtk_tree_insert             (GtkTree          *tree,
  97.                         GtkWidget        *tree_item,
  98.                         gint              position);
  99. void       gtk_tree_remove_items       (GtkTree          *tree,
  100.                         GList            *items);
  101. void       gtk_tree_clear_items        (GtkTree          *tree,
  102.                         gint              start,
  103.                         gint              end);
  104. void       gtk_tree_select_item        (GtkTree          *tree,
  105.                         gint              item);
  106. void       gtk_tree_unselect_item      (GtkTree          *tree,
  107.                         gint              item);
  108. void       gtk_tree_select_child       (GtkTree          *tree,
  109.                         GtkWidget        *tree_item);
  110. void       gtk_tree_unselect_child     (GtkTree          *tree,
  111.                         GtkWidget        *tree_item);
  112. gint       gtk_tree_child_position     (GtkTree          *tree,
  113.                         GtkWidget        *child);
  114. void       gtk_tree_set_selection_mode (GtkTree          *tree,
  115.                         GtkSelectionMode  mode);
  116. void       gtk_tree_set_view_mode      (GtkTree          *tree,
  117.                         GtkTreeViewMode   mode); 
  118. void       gtk_tree_set_view_lines     (GtkTree          *tree,
  119.                     guint            flag);
  120.  
  121. /* deprecated function, use gtk_container_remove instead.
  122.  */
  123. void       gtk_tree_remove_item        (GtkTree          *tree,
  124.                         GtkWidget        *child);
  125.  
  126.  
  127. #ifdef __cplusplus
  128. }
  129. #endif /* __cplusplus */
  130.  
  131.  
  132. #endif /* __GTK_TREE_H__ */
  133.